<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>测试的</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css">
<!--公共样式结束-->
<!--公共JS开始-->
<script src="__PUBLIC__/Js/jquery.min.js"></script>
<script src="__PUBLIC__/Js/jquery.timer.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/common.js"></script>
<!--公共JS结束-->
<!--数据列表插件开始-->
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Plugins/Ettree/Css/ettree.css">
<script src="__PUBLIC__/Plugins/Ettree/Js/ettree.js"></script>
<!--数据列表插件结束-->
<style type="text/css">
body {overflow: hidden;}
.table_box {}
#etTreeTable_box {
	display:block;
	overflow-y:scroll;
}
</style>
</head>

<body>
<div class="page_header">
	<div class="table_tool">
		<ul class="clearfix">
			<!-- <li class="couponDel btn"><i class="icon-remove"></i> 批量删除</li>
			<li class="line"></li> -->
			<li class="openwin btn" etitle="新增字典" eheight="310px" ewidth="500px" ehref="{:U('Dict/add')}" id="Dict_add"><i class="icon-plus"></i> 新增字典</li>
			<li class="line"></li>
		</ul>
	</div>
	<div class="search_box"> 字典名称：
		<select id="dict_pid" style="width:11%;height:100%;" class="form_ele">
			<option value="">请选择</option>
			<volist name="column" id="vo" >
				<eq name="keys" value="$vo.key" >
					<option value="{$vo.key}" selected >{$vo.title}</option>
				<else />
					<option value="{$vo.key}" >{$vo.title}</option>
				</eq>
			</volist>
		</select>
	</div>
</div>
<div class="table_tree">
<form action="{:U('Dict/sort')}" method="post" >
	<input type="hidden" name="key" value="{$key}" />
	<div style="background-color: #E9E9E9;background-image: linear-gradient(to bottom, #F3F3F3 0px, #E3E3E3 100%);">
	<table class="etTreeTable etTreeTable_head" cellspacing="0" cellpadding="0" border="0">
		<thead>					
			<tr class="list_head ct" style="text-align:center">
				<td width="70">排 序</td>
				<td>地名</td>
				<td width="200">操作</td>
			</tr>
		</thead>
	</table>
	</div>
	<div id="etTreeTable_box">
	<table class="etTreeTable" id="dictList" cellspacing="0" cellpadding="0" border="0">
		<tbody id="tree">
		{$htmlTree}
		</tbody>
	</table>
	</div>	
	<table class="etTreeTable" style="background-color:#E9E9E9;" cellspacing="0" cellpadding="0" border="0">
		<tfoot>
			<tr>
				<td colspan="5" valign="middle">
					<button type="submit" class="btn bg_blue white w200 bysort">
					<i class="icon-sort-by-order"></i> 重新排序
				</button>
				</td>
			</tr>
		</tfoot>
	</table>
</form>
</div>
</body>
<script type="text/javascript">
	$(function(){
		function layout(){
			$('.etTreeTable_head').width($(window).width()-18);
			$('#etTreeTable_box').width($(window).width());
			$('#etTreeTable_box').height($(window).height()-140);
			
			$('#tree>tr>td:eq(0)').width(70);
			$('#tree>tr>td:eq(2)').width(200);
		}
		layout();
		
		$(window).on('resize',function(){
			layout();
		});
		
		
		
		//树形节点
		var myConfig = {};
		var myTree = $('#tree').EtTree(myConfig); //#tree为包裹tr的tbody的选择器
		
		//根据选择的栏目查询子栏目
		$("#dict_pid").on('change',function(){
			window.location.href = "{:U('Dict/index')}&key="+$(this).val();
		});
		
		//栏目删除
		$('.delone').live('click',function(){
			var id  = $(this).attr('data-id');
			var pid = $(this).attr('data-pid');
			var keys= "{$keys}";
			$.get("{:U('Dict/del')}",{id:id},function(data){
				 if(data.status==1){
					 windowApi.lhgdialog.alert("删除成功");
				}else{
					 windowApi.lhgdialog.alert("删除失败");
				} 
				window.location.href = "{:U('Dict/index')}&key="+keys;
			},"json");
		});

		
	});
</script>
</html>
